#include <iostream>

using namespace std;

const int N = 1e4 + 10;

int q[N];
int res, cnt = 1;
int n;


int main()
{
	cin >> n;
	cin >> q[1];
	
	for (int i = 2; i < n; i ++ )
	{
		cin >> q[i];
		
		if (q[i] == q[i - 1] + 1) cnt ++ ;
		else cnt = 1;
		
		res = max(cnt, res); 
	}
	cout << res << endl;
	
	return 0; 

}


